package aapilast3;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Scanner;
public class ReflectDemo4 {
    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个类名:");
        String className = sc.nextLine();
        Class<?> cls = Class.forName(className);
        Method[] methods = cls.getMethods();
        for (Method method : methods) {
            System.out.println(method);
            System.out.println(method.getName());
            System.out.println(method.getReturnType());
            System.out.println(method.getParameterCount());
            int modifiers = method.getModifiers();
            switch (modifiers) {
                case Modifier.PUBLIC:
                    System.out.println("public");
                    break;
                case Modifier.PRIVATE:
                    System.out.println("private");
                    break;
                case Modifier.PROTECTED:
                    System.out.println("protected");
                    break;
                default:
                    System.out.println("default");
            }
        }
    }
}
